package com.atlin.project.service.inner;

import com.atlin.beaconsapicommon.model.domain.interfaceInfo.InterfaceInfo;
import com.atlin.beaconsapicommon.service.InnerInterfaceInfoService;
import com.atlin.project.service.InterfaceInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

/**
 * @author atlin
 * @description 内部接口服务实现
 * @createDate 2024/12/22 13:41
 */
@DubboService
public class InnerInterfaceInfoServiceImpl implements InnerInterfaceInfoService {

    @Resource
    private InterfaceInfoService interfaceInfoService;


    @Override
    public InterfaceInfo getInterfaceInfo(String host, String url, String method) {
        if (StringUtils.isAnyBlank(host, url, method)) return null;
        
        QueryWrapper<InterfaceInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StringUtils.isNotBlank(host), "host", host);
        queryWrapper.eq(StringUtils.isNotBlank(url), "url", url);
        queryWrapper.eq(StringUtils.isNotBlank(method), "method", method);
        return interfaceInfoService.getOne(queryWrapper);
    }
}
